package com.zlx.xBiaoShop;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.PropertySource;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;

/**
 * @Author 周罗校
 * @Description
 * @ClassName xBiaoShop
 * @date 2020.12.05 17:22:47
 * 该版权归周罗校所有，最终解释权以官方为准
 */
@SpringBootApplication
@PropertySource("config.properties")
public class xBiaoShop {
    public static void main(String[] args) {
        SpringApplication.run(xBiaoShop.class,args);
    }

    @Bean
    public RedisTemplate redisTemplate(RedisTemplate redisTemplate){

        // value 可见
        redisTemplate.setValueSerializer(new GenericJackson2JsonRedisSerializer());

        // key 可见
        redisTemplate.setKeySerializer(new StringRedisSerializer());

        return redisTemplate;
    }
}
